package org.example;

import redis.clients.jedis.Jedis;

public class Main {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("localhost",6379);
        jedis.set("stock:product1", "10");


        Thread user1=new Thread(()->{
            service service=new service("user1",5);
            service.purchase();
        });

        Thread user2=new Thread(()->{
            service service=new service("user2",6);
            service.purchase();
        });


        Thread user3=new Thread(()->{
            service service=new service("user3",4);
            service.purchase();
        });

        user1.start();
        user2.start();
        user3.start();
    }
}